"use strict";
cc._RF.push(module, 'cd2b22Yw59FWZbf2Hf2eImv', 'PointUtils');
// scripts/utils/PointUtils.js

"use strict";

cc.PointUtils = {
  getDistance: function getDistance(p1, p2) {
    return p1.sub(p2).mag();
  },
  getXySpeed: function getXySpeed(p1, p2, speed) {
    var dis = this.getDistance(p1, p2);
    var t = dis / speed;
    var vx = (p2.x - p1.x) / t;
    var vy = (p2.y - p1.y) / t;
    return cc.v2(vx / 60, vy / 60);
  },
  getAngle: function getAngle(p1, p2) {
    var dx = p2.x - p1.x;
    var dy = p2.y - p1.y;
    var dir = cc.v2(dx, dy);
    var angle = dir.signAngle(cc.v2(1, 0));
    var degree = angle / Math.PI * 180;
    return -degree;
  },
  getMiddlePoint: function getMiddlePoint(p1, p2, ratio) {
    return cc.v2(p1.x + (p2.x - p1.x) * 0.5, p1.y + (p2.y - p1.y) * 0.5);
  }
};

cc._RF.pop();